#ifndef _SMS_TASK_H
#define _SMS_TASK_H

#include "pacmn.h"

#ifdef __cplusplus
extern "C"{
#endif

#define PA_NUM                              0xb
#define PA_SWITCH_OFF                       0x0
#define PA_SWITCH_ON                        0x1


#define PA_ALARM_BIT_OVER_TEMP              0x0
#define PA_ALARM_BIT_OVER_POWER             0x1
#define PA_ALARM_BIT_SWR                    0x2
#define PA_ALARM_BIT_FAULT_PA               0x3
#define PA_ALARM_BIT_FAULT_LNA              0x4
#define PA_ALARM_BIT_SE_PA                  0X5
#define PA_ALARM_BIT_SE_LNA                 0X6


#define PA_STATUS_SWITCH                    0x0
#define PA_STATUS_TEMP           			0x1
#define PA_STATUS_UP_ATT                    0x2
#define PA_STATUS_DN_ATT                    0x3
#define PA_STATUS_DN_POWER                  0x4
#define PA_STATUS_DN_10_POWER               0x5
#define PA_STATUS_STATE             		0x6
#define PA_STATUS_SW10RADIO            		0x7
#define PA_STATUS_TEMPTHRES					0x8
#define PA_STATUS_POWERTHRES				0x9

#define PA_SW_VER                           0X7

typedef struct tag_pa_status {
	uint8_t pa_present[PA_NUM];
    uint8_t pa_addr[PA_NUM];
    uint8_t pa_state[PA_NUM];
    lpa_status_t pa_status[PA_NUM];
} pa_status;

pa_status pa_status_polling();

pa_ret_t set_pa_switch(uint8_t addr_code, uint8_t on_off);
pa_ret_t set_up_att(uint8_t addr_code, uint8_t up_att);
pa_ret_t set_dn_att(uint8_t addr_code, uint8_t dn_att);
pa_ret_t set_pa_reset(uint8_t addr_code);
pa_ret_t set_temp_threshold(uint8_t addr_code, uint8_t temp);
pa_ret_t set_power_threshold(uint8_t addr_code, uint8_t power);

pa_ret_t get_pa_switch(uint8_t addr_code, uint8_t on_off);
pa_ret_t get_pa_temp(uint8_t addr_code, uint8_t temp);
pa_ret_t get_pa_up_att(uint8_t addr_code, uint8_t up_att);
pa_ret_t get_pa_dn_att(uint8_t addr_code, uint8_t dn_att);
pa_ret_t get_dn_power(uint8_t addr_code, uint8_t dn_power);
pa_ret_t get_dn_10_power(uint8_t addr_code, uint8_t dn_power);
pa_ret_t get_pa_state(uint8_t addr_code, uint8_t state);
pa_ret_t get_sw_10_radio(uint8_t addr_code, uint8_t swr);


uint32_t get_pa_number();
pa_ret_t get_pa_status(uint8_t addr_code, uint32_t entry, uint8_t *value);

pa_ret_t initPaCom(uint8_t *ptr);
void termPaCom();
int32_t get_pa_temp_warnthreshold();

#ifdef __cplusplus
}
#endif


#endif //_SMS_TASK_H

